<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{chofer.Titulo}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <p:growl id="message" showDetail="true" />
            <h:form >                        
                <p:panel header="Administración de Choferes" style="font-size: small">                                            
                    <div align="right">    
                        <table width="100%" border="0">
                            <tbody>
                                <tr>       
                                    <td valign="center" align="left">
                                        <p:commandButton ajax="false"  
                                                         action="#{choferController.cargarCrearChofer()}" 
                                                         icon="ui-icon-plusthick"
                                                         value="#{chofer.TituloCrearNuevo}"
                                                         rendered="#{accionController.getAccionByVista('Chofer', 'Crear')}"/>                                        
                                    </td>

                                    <td valign="center" align="right">
                                        <h:commandLink action="#{some_action}">                                            
                                            <h:graphicImage width="35" height="35" url="../img/ico/export/excel.png" alt="download"/>                                                                                        
                                        </h:commandLink>

                                        <h:commandLink action="#{some_action}">                                            
                                            <h:graphicImage width="35" height="35" url="../img/ico/export/pdf.png" alt="download"/>                                            
                                        </h:commandLink>

                                    </td>                                                      
                                </tr>                                
                            </tbody>
                        </table>                                                                      
                    </div>

                    <p:dataTable id="tbl" var="item" value="#{choferController.items}" widgetVar="tablaChoferes"                                                                  
                                 emptyMessage="#{chofer.SinDatos}" 
                                 style="margin-top: 10px"
                                 paginator="true" rows="10" rowKey="#{item.id}">

                        <f:facet name="header">
                            <p:outputPanel>
                                <h:outputText value="Buscar por todos los criterios:" />
                                <p:inputText id="globalFilter" onkeyup="PF('tablaChoferes').filter()" style="width:200px" placeholder="Ingrese la palabra clave"/>
                            </p:outputPanel>
                        </f:facet>                        

                        <p:column headerText="#{chofer.RUC}" filterBy="#{item.ruc}" >
                            <h:outputText value="#{item.ruc}"/>
                        </p:column>            

                        <p:column headerText="#{chofer.Apellidos}" filterBy="#{item.apellidos}" >
                            <h:outputText value="#{item.apellidos}"/>
                        </p:column>                       

                        <p:column headerText="#{chofer.Nombres}" filterBy="#{item.nombres}" >
                            <h:outputText value="#{item.nombres}"/>
                        </p:column>                                         

                        <p:column headerText="Herramientas" >
                            <div class="container" align="center">                                      
                                <p:commandButton ajax="false" action="#{choferController.cargarModificarDetalleChofer(item.id)}" 
                                                 value="#{chofer.Modificar}"
                                                 rendered="#{accionController.getAccionByVista('Chofer', 'Editar')}"/> | 
                                <p:commandButton ajax="false" action="#{choferController.cargarDetalleModificarChofer(item.id)}" 
                                                 value="#{chofer.Detalle}"
                                                 rendered="#{accionController.getAccionByVista('Chofer', 'Ver')}"/>
                            </div>
                        </p:column>                                                            
                    </p:dataTable>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>

